package com.sftz.modules.minapp.coursedetailshomework.service;

import java.util.List;

import org.nutz.dao.SqlManager;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;

import com.sftz.assets.enums.YesOrNoEnum;
import com.sftz.modules.minapp.coursedetailshomework.dto.CourseHomeworkDto;
import com.uxuexi.core.db.dao.IDbDao;
import com.uxuexi.core.db.util.DbSqlUtil;

/**
 * @author   王宏伟
 * @Date	 2018年12月25日 	 
 */
@IocBean
public class CourseHomeworkService {
	@Inject
	protected IDbDao dbDao;
	@Inject
	protected SqlManager sqlManager;

	public List<CourseHomeworkDto> getHomeWorkInfos(Integer courseId, Integer userId) {
		Sql sql = Sqls.create(sqlManager.get("minapp_homework_list"));
		sql.setParam("isPost", YesOrNoEnum.YES.intKey());
		sql.setParam("userId", userId);
		sql.setParam("courseId", courseId);
		sql.setParam("isDelete", YesOrNoEnum.NO.intKey());
		sql.setParam("useStatus", YesOrNoEnum.YES.intKey());
		List<CourseHomeworkDto> homeworkList = DbSqlUtil.query(dbDao, CourseHomeworkDto.class, sql);
		//		for (CourseHomeworkDto courseHomeworkDto : homeworkList) {
		//			if (!Util.isEmpty(courseStruId) && courseHomeworkDto.getCourseStructureId().equals(courseStruId)) {
		//				courseHomeworkDto.setLigthStatus(lightState);
		//			}
		//		}
		return homeworkList;
	}

}
